
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>轩盛金融</title>
    <meta name="keywords" content="轩盛金融">
    <meta name="description" content="轩盛金融">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__CSS__/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__CSS__/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/animate.min.css" rel="stylesheet">
    <link href="__CSS__/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__JS__/layui/css/layui.css"rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>新增活动</small></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link" href="{:url('Am/activityList')}">
                                <i class="fa fa-reply"></i>
                            </a>

                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="post" class="form-horizontal layui-form" enctype="multipart/form-data">
                            {volist name="formData" id="fd"}
                            <div class="form-group">
                                <label for="title" class="col-sm-3 control-label">活动名称</label>

                                <div class="col-sm-6">
                                    <input type="text" lay-verify="required" id="title" name="title" class="form-control layui-input" value="{$fd.title}">
                                </div>
                            </div>


                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label for="thumbnail" class="col-sm-3 control-label">活动封面图片</label>

                                <div id="photo_box">

                                        <div class="col-sm-6">
                                            <img width="100px;" src="{$fd.thumbnail}" alt="标的分类图片">
  
                                        </div>
 
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label for="description" class="col-sm-3 control-label">活动简介</label>

                                <div class="col-sm-6">
                                    <textarea name="description" lay-verify="required" style="resize:none" class="form-control" rows="8">{$fd.description}</textarea>
                                </div>
                            </div>
                    
                            
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="start_time">活动开始时间</label>

                                <div class="col-sm-6">
                                    <input type="type" id="start_time" lay-verify="required" name="start_time" class="form-control" value="{$fd.start_time}">
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="end_time">活动结束时间</label>

                                <div class="col-sm-6">
                                    <input type="type" id="end_time" lay-verify="required" name="end_time" class="form-control" value="{$fd.end_time}">
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="sold_out">是否开启活动</label>
                                <div class="col-sm-6">
                                    <div class="">
                                        <div class="layui-input-block" style="margin-left:0">
                                        {if condition="$fd.sold_out == 1"}
                                          <input type="radio" name="sold_out" value="1" title="是" checked>
                                          <input type="radio" name="sold_out" value="2" title="否" >
                                        {else /}
                                          <input type="radio" name="sold_out" value="1" title="是" >  
                                          <input type="radio" name="sold_out" value="2" title="否" checked>
                                        {/if}  
                                        </div>
                                    </div>
                                </div>
                            </div>

                            

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="container">活动详情</label>

                                <div class="col-sm-6">
                                    <script id="container" name="content" type="text/plain">
                                    </script>
                                </div>
                            </div>

                            <input type="hidden" name="cat_id" value="5">
                            <input type="hidden" name="cat_name" value="活动">
                            <input type="hidden" name="id" value="{$fd.id}">

                            <div class="hr-line-dashed"></div>
<!--                             <div class="form-group">
                                <div class="col-sm-2 col-sm-offset-7">
                                    <button lay-submit lay-filter="upload" class="btn btn-primary btn-block" type="submit">保存内容</button>
                                    
                                </div>
                            </div> -->
                            {/volist}
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="__JS__/jquery.min.js?v=2.1.4"></script>
    <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
    <script src="__JS__/plugins/ueditor/ueditor.config.js"></script>
    <script src="__JS__/plugins/ueditor/ueditor.all.js"></script>
    <script src="__JS__/layui/layui.js"></script>
    <script>
    // 富文本赋值
        function UeValue(ueName,ueValue){
            this.ueName = ueName;
            this.ueValue = ueValue;
        }
        UeValue.prototype.value = function(){
            // 保存后台传的数据
            // this -> 正在调用的对象(全局)
            var value = this.ueValue;

            // this -> 正在调用的对象(全局)
            this.ueName.ready(function(){
                // this - > ueName (不再是全局,是在 ueName 内部)
                this.setContent(value);    
            })
        }


    // 富文本设置
        var editor = UE.getEditor('container',{
            toolbars: [[
        ]],
        autoHeightEnabled:true,
        initialFrameHeight:400
        });

        // 从后端获取数据,并赋值到 Ueditor 
        var getUeValue = new UeValue(editor,'<?php echo $formData[0]["content"];?>');
        getUeValue.value();

        // 引用layui
        layui.use(['layer', 'form','laydate'], function(){
          var layer = layui.layer;
          var form = layui.form;
          var laydate = layui.laydate;

          laydate.render({
            elem: '#start_time',
            type: 'datetime',
            theme: 'molv',
            min: 0,
            format: 'yyyy-MM-dd HH:mm:ss'
          });

          laydate.render({
            elem: '#end_time',
            type: 'datetime',
            theme: 'molv',
            min: 0,
            format: 'yyyy-MM-dd HH:mm:ss'
          });

        });


        $('#change_photo').on('click',function(event){
            event.preventDefault();
            $('#photo_box').html(
                '<input class="col-sm-6" lay-verify="required" type="file" id="thumbnail" name="thumbnail" accept="image/*"/>'
            );
        })
    </script>
</body>

</html>
